<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/5/31
 * Time: 14:23
 */

if(!empty($_REQUEST["pid"])){

    $strGoods = file_get_contents("data/goodsList.json");
    $arrGoods = json_decode($strGoods);

    for($i = 0; $i < count($arrGoods); $i++){
        if($arrGoods[$i]->pid == $_REQUEST["pid"]){
            print_r(json_encode(Array("status" => 1, "data" => $arrGoods[$i])));
            return;
        }
    }
    print_r(json_encode(Array("status" => 0, "msg" => "没有产品", "erroNo" => -3)));
} else {
    print_r(json_encode(Array("status" => 0, "msg" => "异常", "erroNo" => -2)));
}